var autoIncrement = require('mongoose-auto-increment')
var mongoose = require('mongoose');
var schema = mongoose.Schema;

var Region = function(){

    var areaSchema = new schema({
        "label":{ type: String, index: true },
        "value":{ type: Number, index: true }
    });

    var citySchema = new schema({
        "label":{ type: String, index: true },
        "value":{ type: Number, index: true },
        "children": [areaSchema]
    });

    var provinceSchema = new schema({
        "label":{ type: String, index: true },
        "value":{ type: Number, index: true },
        "children": [citySchema]
    });

    return mongoose.model('Region',provinceSchema, 'Region');
};

module.exports = Region;
